//Quiz processing section follows Enable quiz on HTML pages to process
var count=0;

//terresterial quiz
function processTerresterial()
{
	count = 0;
	var q1 = document.forms.assessment.question1;
	var q2 = document.forms.assessment.question2;
	var q3 = document.forms.assessment.question3;
	var q4 = document.forms.assessment.question4;
	var q5 = document.forms.assessment.question5;
	var q6 = document.forms.assessment.question6;
	var q7 = document.forms.assessment.question7;
	var q8 = document.forms.assessment.question8;
	var q9 = document.forms.assessment.question9;
	var q10 = document.forms.assessment.question10;
	//alert ( "q1[ 1 ].checked is " + q1[ 1 ].checked );
	if ( q1[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q2[ 1 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q3[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q4[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q5[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q6[ 1 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q7[ 1 ].checked == true )
	{
		count = count + 1;
	}
	if ( q8[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q9[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q10[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( count >= 7 )
	{
		alert ( "Congratulations, you passed!  Your grade is " + count +"0%!" );
		sessionStorage.setItem ( "passTerresterialQuiz", "1" );
		showQuiz();
	}
	else
	{
		alert ( "Nice try, you got " + count + " answers correct, please try again.");
	}
}

//Quiz processing section follows Enable quiz on HTML pages to process
var count=0;

//-----------------------------------------------------------------------------------------------------
//gaseous quiz
function processGaseous()
{
	count = 0;
	var q1 = document.forms.assessment.question1;
	var q2 = document.forms.assessment.question2;
	var q3 = document.forms.assessment.question3;
	var q4 = document.forms.assessment.question4;
	var q5 = document.forms.assessment.question5;
	var q6 = document.forms.assessment.question6;
	var q7 = document.forms.assessment.question7;
	var q8 = document.forms.assessment.question8;
	var q9 = document.forms.assessment.question9;
	var q10 = document.forms.assessment.question10;
	//alert ( "q1[ 1 ].checked is " + q1[ 1 ].checked );
	if ( q1[ 1 ].checked == true )
	{
		count = count + 1;
	}
	if ( q2[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q3[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q4[ 1 ].checked == true )
	{
		count = count + 1;
	}
	if ( q5[ 2 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q6[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q7[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q8[ 2 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q9[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q10[ 2 ].checked == true )
	{
		count = count + 1;
	}
	if ( count >= 7 )
	{
		alert ( "Congratulations, you passed!  Your grade is " + count +"0%!" );
		sessionStorage.setItem( "passGaseousQuiz", "1" );
		showQuiz();
	}
	else
	{
		alert ( "Nice try, you got " + count + " answers correct, please try again.");
	}
}

//Quiz processing section follows Enable quiz on HTML pages to process
var count=0;

//-----------------------------------------------------------------------------------------------------
//final quiz
function processFinal()
{
	count = 0;
	var pm = sessionStorage.getItem( "planetMatch" );
	var pmcount = 0;
	var q1 = document.forms.assessment.question1;
	var q2 = document.forms.assessment.question2;
	var q3 = document.forms.assessment.question3;
	var q4 = document.forms.assessment.question4;
	var q5 = document.forms.assessment.question5;
	var q6 = document.forms.assessment.question6;
	var q7 = document.forms.assessment.question7;
	var q8 = document.forms.assessment.question8;
	var q9 = document.forms.assessment.question9;
	var q10 = document.forms.assessment.question10;
	var q11 = document.forms.assessment.question11;
	var q12 = document.forms.assessment.question12;
	var q13 = document.forms.assessment.question13;
	var q14 = document.forms.assessment.question14;
	var q15 = document.forms.assessment.question15;
	var q16 = document.forms.assessment.question16;
	var q17 = document.forms.assessment.question17;
	var q18 = document.forms.assessment.question18;
	var q19 = document.forms.assessment.question19;
	var q20 = document.forms.assessment.question20;
	if ( pm == 20 )
	{
		pmcount = 20;
	}
	if ( q1[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q2[ 1 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q3[ 1 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q4[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q5[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q6[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q7[ 3 ].checked == true )
	{
		count = count + 1;
	}
	if ( q8[ 1 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q9[ 2 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q10[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q11[ 1 ].checked == true )
	{
		count = count + 1;
	}
	if ( q12[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q13[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q14[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( q15[ 0 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q16[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q17[ 1 ].checked == true )
	{
		count = count + 1;
	}
	if ( q18[ 1 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q19[ 3 ].checked == true )
	{
		count = count + 1;
	}	
	if ( q20[ 0 ].checked == true )
	{
		count = count + 1;
	}
	if ( count >= 14 )
	{
		document.getElementById( "certificate" ).className = "show";
		count = count * 4 + pmcount;
		var cert = alert ( "Congratulations, you passed! Your grade is " + count + "%!" );
		sessionStorage.setItem( "finalquiz", count );
		parent.reportScores( count );
	}
	else
	{
		alert ( "Nice try, you got " + count + " answers correct, try again.");
	}
}
